\hypertarget{class_state}{\section{State Class Reference}
\label{class_state}\index{State@{State}}
}


{\ttfamily \#include $<$State.\-hpp$>$}

Inheritance diagram for State\-:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=12.000000cm]{class_state}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_state_ab91bb1dd5aa6260ab2a456581daf9ec2}{State} ()
\item 
virtual \hyperlink{class_state_afab438d92b90dc18d194dbd9c9c8bab3}{$\sim$\-State} ()
\item 
const std\-::map$<$ \hyperlink{class_state_done_code}{State\-Done\-Code}, \\*
\hyperlink{class_state}{State} $\ast$ $>$ \& \hyperlink{class_state_a92b5cea13d0979711a1e9d364b101090}{Get\-Transitions} ()
\item 
void \hyperlink{class_state_ac7048d46adbba2594bac21ed28f5b688}{Add\-Transition} (\hyperlink{class_state}{State} \&state)
\item 
void \hyperlink{class_state_a386cc0be3fd5f6f0bdd6762fb7241440}{Add\-Transition} (\hyperlink{class_state_done_code}{State\-Done\-Code} done\-Code, \hyperlink{class_state}{State} \&state)
\item 
void \hyperlink{class_state_affc91f3b2042c17937831e72987c18c4}{Remove\-Transition} (\hyperlink{class_state_done_code}{State\-Done\-Code} done\-Code)
\item 
\hyperlink{class_state_done_code}{State\-Done\-Code} \hyperlink{class_state_a9039982e4062751c0f8980e7f27a6843}{Get\-Done\-Code} ()
\item 
\hyperlink{class_state}{State} \& \hyperlink{class_state_a9826f43ac54827729f7c153b5d064597}{Get\-Next\-State} ()
\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
virtual void \hyperlink{class_state_a3a160d410512e0f4529210aa8e1d9117}{Handle\-Activate} ()
\item 
virtual void \hyperlink{class_state_a877215e69abc4eaf66fdc0ae25296e6a}{Handle\-Deactivate} ()
\item 
virtual void \hyperlink{class_state_a29e67195da90c4c44e0e8f0fbe938c7c}{Handle\-Periodic} ()
\item 
virtual void \hyperlink{class_state_a8fd757a8c9b92a4387c37657644498cf}{Handle\-Continuous} ()
\item 
void \hyperlink{class_state_afc24d1a3d56c4d41fe85329e372f2146}{Set\-Done\-Code} (\hyperlink{class_state_done_code}{State\-Done\-Code} done\-Code)
\item 
{\footnotesize template$<$typename T $>$ }\\T \& \hyperlink{class_state_aec621ef40098f04ed24b3b6cd4164fc2}{Require\-Control} (T \&obj)
\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_state_ad8c7806d4e98a1747e10c6ee871410b9}{class {\bfseries State\-Machine\-Service}}\label{class_state_ad8c7806d4e98a1747e10c6ee871410b9}

\end{DoxyCompactItemize}
\subsection*{Additional Inherited Members}


\subsection{Detailed Description}
The \hyperlink{class_state}{State} class is used by the State\-Machine\-Controller.

The \hyperlink{class_state}{State} class is a special Robot\-Controller that acts as a state in the state machine in State\-Machine\-Controller. States stores a transition map that maps a \hyperlink{class_state_done_code}{State\-Done\-Code} to another \hyperlink{class_state}{State}. When the state is done, it sets the \char`\"{}done code\char`\"{}. When the done code is set, the state machine moves on to the \hyperlink{class_state}{State} specified by the transition map.

This class seems to work. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_state_ab91bb1dd5aa6260ab2a456581daf9ec2}{\index{State@{State}!State@{State}}
\index{State@{State}!State@{State}}
\subsubsection[{State}]{\setlength{\rightskip}{0pt plus 5cm}State\-::\-State (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{class_state_ab91bb1dd5aa6260ab2a456581daf9ec2}
Constructor for \hyperlink{class_state}{State}. \hypertarget{class_state_afab438d92b90dc18d194dbd9c9c8bab3}{\index{State@{State}!$\sim$\-State@{$\sim$\-State}}
\index{$\sim$\-State@{$\sim$\-State}!State@{State}}
\subsubsection[{$\sim$\-State}]{\setlength{\rightskip}{0pt plus 5cm}State\-::$\sim$\-State (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}}\label{class_state_afab438d92b90dc18d194dbd9c9c8bab3}
Desturctor for \hyperlink{class_state}{State}. 

\subsection{Member Function Documentation}
\hypertarget{class_state_ac7048d46adbba2594bac21ed28f5b688}{\index{State@{State}!Add\-Transition@{Add\-Transition}}
\index{Add\-Transition@{Add\-Transition}!State@{State}}
\subsubsection[{Add\-Transition}]{\setlength{\rightskip}{0pt plus 5cm}void State\-::\-Add\-Transition (
\begin{DoxyParamCaption}
\item[{{\bf State} \&}]{state}
\end{DoxyParamCaption}
)}}\label{class_state_ac7048d46adbba2594bac21ed28f5b688}
Adds a transition that specifies which state to transition if the state finishes successfully.


\begin{DoxyParams}{Parameters}
{\em state} & The \hyperlink{class_state}{State} to transition to. \\
\hline
\end{DoxyParams}
\hypertarget{class_state_a386cc0be3fd5f6f0bdd6762fb7241440}{\index{State@{State}!Add\-Transition@{Add\-Transition}}
\index{Add\-Transition@{Add\-Transition}!State@{State}}
\subsubsection[{Add\-Transition}]{\setlength{\rightskip}{0pt plus 5cm}void State\-::\-Add\-Transition (
\begin{DoxyParamCaption}
\item[{{\bf State\-Done\-Code}}]{done\-Code, }
\item[{{\bf State} \&}]{state}
\end{DoxyParamCaption}
)}}\label{class_state_a386cc0be3fd5f6f0bdd6762fb7241440}
Adds a transition that specifies which state to transition if the state finishes with the specified Done\-Code.


\begin{DoxyParams}{Parameters}
{\em done\-Code} & The Done\-Code for the transition. \\
\hline
{\em state} & The \hyperlink{class_state}{State} to transition to. \\
\hline
\end{DoxyParams}
\hypertarget{class_state_a9039982e4062751c0f8980e7f27a6843}{\index{State@{State}!Get\-Done\-Code@{Get\-Done\-Code}}
\index{Get\-Done\-Code@{Get\-Done\-Code}!State@{State}}
\subsubsection[{Get\-Done\-Code}]{\setlength{\rightskip}{0pt plus 5cm}{\bf State\-Done\-Code} State\-::\-Get\-Done\-Code (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{class_state_a9039982e4062751c0f8980e7f27a6843}
Gets the \hyperlink{class_state}{State}'s \hyperlink{class_state_done_code}{State\-Done\-Code}.

If the \hyperlink{class_state}{State} is not done, it returns State\-Done\-Code\-::\-Get\-Not\-Done\-Code().

\begin{DoxyReturn}{Returns}
The \hyperlink{class_state_done_code}{State\-Done\-Code}. 
\end{DoxyReturn}
\hypertarget{class_state_a9826f43ac54827729f7c153b5d064597}{\index{State@{State}!Get\-Next\-State@{Get\-Next\-State}}
\index{Get\-Next\-State@{Get\-Next\-State}!State@{State}}
\subsubsection[{Get\-Next\-State}]{\setlength{\rightskip}{0pt plus 5cm}{\bf State} \& State\-::\-Get\-Next\-State (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{class_state_a9826f43ac54827729f7c153b5d064597}
Gets the next \hyperlink{class_state}{State}.

If the \hyperlink{class_state}{State} is not done, it returns itself.

\begin{DoxyReturn}{Returns}
The next \hyperlink{class_state}{State}. 
\end{DoxyReturn}
\hypertarget{class_state_a92b5cea13d0979711a1e9d364b101090}{\index{State@{State}!Get\-Transitions@{Get\-Transitions}}
\index{Get\-Transitions@{Get\-Transitions}!State@{State}}
\subsubsection[{Get\-Transitions}]{\setlength{\rightskip}{0pt plus 5cm}const map$<$ {\bf State\-Done\-Code}, {\bf State} $\ast$ $>$ \& State\-::\-Get\-Transitions (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{class_state_a92b5cea13d0979711a1e9d364b101090}
Returns the transitions map that maps a done code to a state.

\begin{DoxyReturn}{Returns}
The transition map that maps a done code to a state. 
\end{DoxyReturn}
\hypertarget{class_state_a3a160d410512e0f4529210aa8e1d9117}{\index{State@{State}!Handle\-Activate@{Handle\-Activate}}
\index{Handle\-Activate@{Handle\-Activate}!State@{State}}
\subsubsection[{Handle\-Activate}]{\setlength{\rightskip}{0pt plus 5cm}void State\-::\-Handle\-Activate (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [virtual]}}}\label{class_state_a3a160d410512e0f4529210aa8e1d9117}
Runs when the state is first run. 

Reimplemented in \hyperlink{class_mecanum_drive_subsystem_1_1_drive_start_state_a84daeab03132061b1b7acbc58d2ca2a8}{Mecanum\-Drive\-Subsystem\-::\-Drive\-Start\-State}, \hyperlink{class_chain_state_a3be88e1f294b5f958a69a17eea7cc941}{Chain\-State}, \hyperlink{class_instant_state_a054dbdbc513552eacab938c0245e22fa}{Instant\-State}, \hyperlink{class_digital_input_check_state_ab91a5c594a247e2544759560ed0f64cc}{Digital\-Input\-Check\-State}, and \hyperlink{class_time_wait_state_aa42ceb5a951505135ac8e88b2260c30f}{Time\-Wait\-State}.

\hypertarget{class_state_a8fd757a8c9b92a4387c37657644498cf}{\index{State@{State}!Handle\-Continuous@{Handle\-Continuous}}
\index{Handle\-Continuous@{Handle\-Continuous}!State@{State}}
\subsubsection[{Handle\-Continuous}]{\setlength{\rightskip}{0pt plus 5cm}void State\-::\-Handle\-Continuous (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [virtual]}}}\label{class_state_a8fd757a8c9b92a4387c37657644498cf}
Continuously runs if the state is not done yet. \hypertarget{class_state_a877215e69abc4eaf66fdc0ae25296e6a}{\index{State@{State}!Handle\-Deactivate@{Handle\-Deactivate}}
\index{Handle\-Deactivate@{Handle\-Deactivate}!State@{State}}
\subsubsection[{Handle\-Deactivate}]{\setlength{\rightskip}{0pt plus 5cm}void State\-::\-Handle\-Deactivate (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [virtual]}}}\label{class_state_a877215e69abc4eaf66fdc0ae25296e6a}
Runs when the state is stops. \hypertarget{class_state_a29e67195da90c4c44e0e8f0fbe938c7c}{\index{State@{State}!Handle\-Periodic@{Handle\-Periodic}}
\index{Handle\-Periodic@{Handle\-Periodic}!State@{State}}
\subsubsection[{Handle\-Periodic}]{\setlength{\rightskip}{0pt plus 5cm}void State\-::\-Handle\-Periodic (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [virtual]}}}\label{class_state_a29e67195da90c4c44e0e8f0fbe938c7c}
Periodicly runs if the state is not done yet. 

Reimplemented from \hyperlink{class_service_a9604d04295202019e9a15f8c93bb31c6}{Service}.



Reimplemented in \hyperlink{class_async_result_finish_state_a9c327aa447e197c8f6e3b50150d46162}{Async\-Result\-Finish\-State$<$ Result $>$}, \hyperlink{class_async_status_finish_state_a21f727ef7e4c1e5f284febf8f649f19a}{Async\-Status\-Finish\-State}, and \hyperlink{class_time_wait_state_a67589e93acff3c395470f3fb4ad43e57}{Time\-Wait\-State}.

\hypertarget{class_state_affc91f3b2042c17937831e72987c18c4}{\index{State@{State}!Remove\-Transition@{Remove\-Transition}}
\index{Remove\-Transition@{Remove\-Transition}!State@{State}}
\subsubsection[{Remove\-Transition}]{\setlength{\rightskip}{0pt plus 5cm}void State\-::\-Remove\-Transition (
\begin{DoxyParamCaption}
\item[{{\bf State\-Done\-Code}}]{done\-Code}
\end{DoxyParamCaption}
)}}\label{class_state_affc91f3b2042c17937831e72987c18c4}
Removes the transition with the specified \hyperlink{class_state_done_code}{State\-Done\-Code}.


\begin{DoxyParams}{Parameters}
{\em done\-Code} & The Done\-Code of the transition. \\
\hline
\end{DoxyParams}
\hypertarget{class_state_aec621ef40098f04ed24b3b6cd4164fc2}{\index{State@{State}!Require\-Control@{Require\-Control}}
\index{Require\-Control@{Require\-Control}!State@{State}}
\subsubsection[{Require\-Control}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ T\& State\-::\-Require\-Control (
\begin{DoxyParamCaption}
\item[{T \&}]{obj}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [protected]}}}\label{class_state_aec621ef40098f04ed24b3b6cd4164fc2}
Add required control lock on an object (such as a \hyperlink{class_robot_subsystem}{Robot\-Subsystem}).

The lock is only acquired when the subscriber/service/operation is running. This prevents two unrelated subscribers from using the same object at the same time. For more information on using locking, see our \hyperlink{class_thread}{Thread} Safety Manuel that does not exist yet. \-:P


\begin{DoxyParams}{Parameters}
{\em obj} & The object to be locked.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The obj parameter. 
\end{DoxyReturn}
\hypertarget{class_state_afc24d1a3d56c4d41fe85329e372f2146}{\index{State@{State}!Set\-Done\-Code@{Set\-Done\-Code}}
\index{Set\-Done\-Code@{Set\-Done\-Code}!State@{State}}
\subsubsection[{Set\-Done\-Code}]{\setlength{\rightskip}{0pt plus 5cm}void State\-::\-Set\-Done\-Code (
\begin{DoxyParamCaption}
\item[{{\bf State\-Done\-Code}}]{done\-Code}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}}\label{class_state_afc24d1a3d56c4d41fe85329e372f2146}
Sets the \hyperlink{class_state}{State}'s \hyperlink{class_state_done_code}{State\-Done\-Code}, thereby finishing the \hyperlink{class_state}{State}.


\begin{DoxyParams}{Parameters}
{\em done\-Code} & The \hyperlink{class_state_done_code}{State\-Done\-Code}. \\
\hline
\end{DoxyParams}


The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
C\-:/\-Users/\-Sam/\-Projects/\-F\-R\-C/\-Libraries/\-Fpk/\-Entech-\/\-Fpk-\/\-Subscribers/\-Entech-\/\-Fpk/State.\-hpp\item 
C\-:/\-Users/\-Sam/\-Projects/\-F\-R\-C/\-Libraries/\-Fpk/\-Entech-\/\-Fpk-\/\-Subscribers/\-Entech-\/\-Fpk/State.\-cpp\end{DoxyCompactItemize}
